package com.android.demo.notepad2;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TabHost;
import android.widget.TextView;

public class TabPres extends TabActivity {
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    TextView title;

	    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
	    
	    setContentView(R.layout.main);
 
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
        
        title = (TextView)findViewById(R.id.header);
        title.setText("  Hello Sopra !");
        
        
	    getResources(); // Resource object to get Drawables
	    TabHost tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Reusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab
	  //######################TAB   1  #####################################	    

	    // Create an Intent to launch an Activity for the tab (to be reused)
	    intent = new Intent().setClass(this, Notepadv2.class);
	    intent.putExtra("db", "col1");
	    // Initialize a TabSpec for each tab and add it to the TabHost
	    View view = LayoutInflater.from(this).inflate(R.layout.tabs_bg, null);
	    TextView text = (TextView)view.findViewById(R.id.tabsText);
	    text.setText("Bloc-notes");
	    spec = tabHost.newTabSpec("db1s").setIndicator(view)
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    //tabHost.getTabWidget().getChildAt(0).setBackgroundColor(Color.parseColor("#FF0000"));
	  //#########################TAB   2 ############################################	    

	    intent = new Intent().setClass(this, WebSite.class);
	   
	    // Initialize a TabSpec for each tab and add it to the TabHost
	     view = LayoutInflater.from(this).inflate(R.layout.tabs_bg_web, null);
	     text = (TextView)view.findViewById(R.id.tabsText);
	    text.setText("Site");
	    spec = tabHost.newTabSpec("db2").setIndicator(view)
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
 //########################TAB 3    ##############################	    

	    
	    intent = new Intent().setClass(this, SopraMapView.class);
		   
	    // Initialize a TabSpec for each tab and add it to the TabHost
	     view = LayoutInflater.from(this).inflate(R.layout.tabs_bg_map, null);
	     text = (TextView)view.findViewById(R.id.tabsText);
	    text.setText("Carte");
	    spec = tabHost.newTabSpec("db3").setIndicator(view)
	                  .setContent(intent);
	    tabHost.addTab(spec);

//#####################################################################	    
	    
	    
	    tabHost.setCurrentTab(0);
	}
	
	 @Override
	    protected void onPause() {
	        super.onPause();
	 

	    }
	    
		 @Override
		    protected void onResume() {
		        super.onResume();

		    }
    
    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        System.out.println("closin SAVING");
       
    }
    
    @Override
    protected void onDestroy() {
        super.onDestroy();
    
    }
}
